package com.sdgs.paas.sdk.core.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.config.client.ConfigServerInstanceProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.sdgs.paas.sdk.core.log.PaasLogger;

/**
 * 日志功能自动配置
 *
 * @author wjj
 *
 */
@Configuration
@ConditionalOnBean(ConfigServerInstanceProvider.class)
@EnableConfigurationProperties(PaasPlainConfigFileProperties.class)
public class PaasPlainConfigFileServiceAutoConfiguration {

	@Bean
	@ConditionalOnProperty(prefix = "shtelpaas.plainconfigfile", name = "enabled", matchIfMissing = true, havingValue = "true")
	public PaasPlainConfigFileService paasPlainConfigFileService(PaasPlainConfigFileProperties config) {

		PaasPlainConfigFileService paasPlainConfigFileService = new PaasPlainConfigFileService();

		PaasLogger.info("PaasPlainConfigFileService创建成功!");

		return paasPlainConfigFileService;
	}

}
